import { getPerson } from "../../api/user";
import { sleep } from "../../utils/index";

Page({
  data: {
    userInfo: null, // 用户信息
  },

  jumpLoginPage() {
    wx.navigateTo({
      url: "/pages/login/login",
    });
  },

  /**
   * 获取数据
   */
  async refresh() {
    await sleep(2000);
    const resp = await getPerson();
    this.setData({ userInfo: resp });
  },

  onLoad() {
    this.refresh();
  },
});
